import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/major_hazard/hazard_instrument_entity.dart';

HazardInstrumentEntity $HazardInstrumentEntityFromJson(Map<String, dynamic> json) {
  final HazardInstrumentEntity hazardInstrumentEntity = HazardInstrumentEntity();
  final String? backupLinkAddress = jsonConvert.convert<String>(json['backupLinkAddress']);
  if (backupLinkAddress != null) {
    hazardInstrumentEntity.backupLinkAddress = backupLinkAddress;
  }
  final String? equipCode = jsonConvert.convert<String>(json['equipCode']);
  if (equipCode != null) {
    hazardInstrumentEntity.equipCode = equipCode;
  }
  final String? equipName = jsonConvert.convert<String>(json['equipName']);
  if (equipName != null) {
    hazardInstrumentEntity.equipName = equipName;
  }
  final String? equipTypeDicId = jsonConvert.convert<String>(json['equipTypeDicId']);
  if (equipTypeDicId != null) {
    hazardInstrumentEntity.equipTypeDicId = equipTypeDicId;
  }
  final String? equipTypeName = jsonConvert.convert<String>(json['equipTypeName']);
  if (equipTypeName != null) {
    hazardInstrumentEntity.equipTypeName = equipTypeName;
  }
  final String? hazardCode = jsonConvert.convert<String>(json['hazardCode']);
  if (hazardCode != null) {
    hazardInstrumentEntity.hazardCode = hazardCode;
  }
  final List<HazardInstrumentHazardTargetVOList>? hazardTargetVOList = (json['hazardTargetVOList'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<HazardInstrumentHazardTargetVOList>(e) as HazardInstrumentHazardTargetVOList).toList();
  if (hazardTargetVOList != null) {
    hazardInstrumentEntity.hazardTargetVOList = hazardTargetVOList;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    hazardInstrumentEntity.id = id;
  }
  final String? manLinkAddress = jsonConvert.convert<String>(json['manLinkAddress']);
  if (manLinkAddress != null) {
    hazardInstrumentEntity.manLinkAddress = manLinkAddress;
  }
  return hazardInstrumentEntity;
}

Map<String, dynamic> $HazardInstrumentEntityToJson(HazardInstrumentEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['backupLinkAddress'] = entity.backupLinkAddress;
  data['equipCode'] = entity.equipCode;
  data['equipName'] = entity.equipName;
  data['equipTypeDicId'] = entity.equipTypeDicId;
  data['equipTypeName'] = entity.equipTypeName;
  data['hazardCode'] = entity.hazardCode;
  data['hazardTargetVOList'] = entity.hazardTargetVOList?.map((v) => v.toJson()).toList();
  data['id'] = entity.id;
  data['manLinkAddress'] = entity.manLinkAddress;
  return data;
}

extension HazardInstrumentEntityExtension on HazardInstrumentEntity {
  HazardInstrumentEntity copyWith({
    String? backupLinkAddress,
    String? equipCode,
    String? equipName,
    String? equipTypeDicId,
    String? equipTypeName,
    String? hazardCode,
    List<HazardInstrumentHazardTargetVOList>? hazardTargetVOList,
    String? id,
    String? manLinkAddress,
  }) {
    return HazardInstrumentEntity()
      ..backupLinkAddress = backupLinkAddress ?? this.backupLinkAddress
      ..equipCode = equipCode ?? this.equipCode
      ..equipName = equipName ?? this.equipName
      ..equipTypeDicId = equipTypeDicId ?? this.equipTypeDicId
      ..equipTypeName = equipTypeName ?? this.equipTypeName
      ..hazardCode = hazardCode ?? this.hazardCode
      ..hazardTargetVOList = hazardTargetVOList ?? this.hazardTargetVOList
      ..id = id ?? this.id
      ..manLinkAddress = manLinkAddress ?? this.manLinkAddress;
  }
}

HazardInstrumentHazardTargetVOList $HazardInstrumentHazardTargetVOListFromJson(Map<String, dynamic> json) {
  final HazardInstrumentHazardTargetVOList hazardInstrumentHazardTargetVOList = HazardInstrumentHazardTargetVOList();
  final String? equipCode = jsonConvert.convert<String>(json['equipCode']);
  if (equipCode != null) {
    hazardInstrumentHazardTargetVOList.equipCode = equipCode;
  }
  final String? equipName = jsonConvert.convert<String>(json['equipName']);
  if (equipName != null) {
    hazardInstrumentHazardTargetVOList.equipName = equipName;
  }
  final String? equipTypeDicId = jsonConvert.convert<String>(json['equipTypeDicId']);
  if (equipTypeDicId != null) {
    hazardInstrumentHazardTargetVOList.equipTypeDicId = equipTypeDicId;
  }
  final String? equipTypeName = jsonConvert.convert<String>(json['equipTypeName']);
  if (equipTypeName != null) {
    hazardInstrumentHazardTargetVOList.equipTypeName = equipTypeName;
  }
  final String? hazardCode = jsonConvert.convert<String>(json['hazardCode']);
  if (hazardCode != null) {
    hazardInstrumentHazardTargetVOList.hazardCode = hazardCode;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    hazardInstrumentHazardTargetVOList.id = id;
  }
  final String? lastCollectTime = jsonConvert.convert<String>(json['lastCollectTime']);
  if (lastCollectTime != null) {
    hazardInstrumentHazardTargetVOList.lastCollectTime = lastCollectTime;
  }
  final int? lastValue = jsonConvert.convert<int>(json['lastValue']);
  if (lastValue != null) {
    hazardInstrumentHazardTargetVOList.lastValue = lastValue;
  }
  final String? online = jsonConvert.convert<String>(json['online']);
  if (online != null) {
    hazardInstrumentHazardTargetVOList.online = online;
  }
  final int? rangeDown = jsonConvert.convert<int>(json['rangeDown']);
  if (rangeDown != null) {
    hazardInstrumentHazardTargetVOList.rangeDown = rangeDown;
  }
  final int? rangeUp = jsonConvert.convert<int>(json['rangeUp']);
  if (rangeUp != null) {
    hazardInstrumentHazardTargetVOList.rangeUp = rangeUp;
  }
  final String? targetCode = jsonConvert.convert<String>(json['targetCode']);
  if (targetCode != null) {
    hazardInstrumentHazardTargetVOList.targetCode = targetCode;
  }
  final String? targetName = jsonConvert.convert<String>(json['targetName']);
  if (targetName != null) {
    hazardInstrumentHazardTargetVOList.targetName = targetName;
  }
  final String? targetStatus = jsonConvert.convert<String>(json['targetStatus']);
  if (targetStatus != null) {
    hazardInstrumentHazardTargetVOList.targetStatus = targetStatus;
  }
  final String? targetTypeDicId = jsonConvert.convert<String>(json['targetTypeDicId']);
  if (targetTypeDicId != null) {
    hazardInstrumentHazardTargetVOList.targetTypeDicId = targetTypeDicId;
  }
  final String? targetTypeDicName = jsonConvert.convert<String>(json['targetTypeDicName']);
  if (targetTypeDicName != null) {
    hazardInstrumentHazardTargetVOList.targetTypeDicName = targetTypeDicName;
  }
  final int? thresholdDown = jsonConvert.convert<int>(json['thresholdDown']);
  if (thresholdDown != null) {
    hazardInstrumentHazardTargetVOList.thresholdDown = thresholdDown;
  }
  final int? thresholdDown2 = jsonConvert.convert<int>(json['thresholdDown2']);
  if (thresholdDown2 != null) {
    hazardInstrumentHazardTargetVOList.thresholdDown2 = thresholdDown2;
  }
  final int? thresholdUp = jsonConvert.convert<int>(json['thresholdUp']);
  if (thresholdUp != null) {
    hazardInstrumentHazardTargetVOList.thresholdUp = thresholdUp;
  }
  final int? thresholdUp2 = jsonConvert.convert<int>(json['thresholdUp2']);
  if (thresholdUp2 != null) {
    hazardInstrumentHazardTargetVOList.thresholdUp2 = thresholdUp2;
  }
  final String? unit = jsonConvert.convert<String>(json['unit']);
  if (unit != null) {
    hazardInstrumentHazardTargetVOList.unit = unit;
  }
  return hazardInstrumentHazardTargetVOList;
}

Map<String, dynamic> $HazardInstrumentHazardTargetVOListToJson(HazardInstrumentHazardTargetVOList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['equipCode'] = entity.equipCode;
  data['equipName'] = entity.equipName;
  data['equipTypeDicId'] = entity.equipTypeDicId;
  data['equipTypeName'] = entity.equipTypeName;
  data['hazardCode'] = entity.hazardCode;
  data['id'] = entity.id;
  data['lastCollectTime'] = entity.lastCollectTime;
  data['lastValue'] = entity.lastValue;
  data['online'] = entity.online;
  data['rangeDown'] = entity.rangeDown;
  data['rangeUp'] = entity.rangeUp;
  data['targetCode'] = entity.targetCode;
  data['targetName'] = entity.targetName;
  data['targetStatus'] = entity.targetStatus;
  data['targetTypeDicId'] = entity.targetTypeDicId;
  data['targetTypeDicName'] = entity.targetTypeDicName;
  data['thresholdDown'] = entity.thresholdDown;
  data['thresholdDown2'] = entity.thresholdDown2;
  data['thresholdUp'] = entity.thresholdUp;
  data['thresholdUp2'] = entity.thresholdUp2;
  data['unit'] = entity.unit;
  return data;
}

extension HazardInstrumentHazardTargetVOListExtension on HazardInstrumentHazardTargetVOList {
  HazardInstrumentHazardTargetVOList copyWith({
    String? equipCode,
    String? equipName,
    String? equipTypeDicId,
    String? equipTypeName,
    String? hazardCode,
    String? id,
    String? lastCollectTime,
    int? lastValue,
    String? online,
    int? rangeDown,
    int? rangeUp,
    String? targetCode,
    String? targetName,
    String? targetStatus,
    String? targetTypeDicId,
    String? targetTypeDicName,
    int? thresholdDown,
    int? thresholdDown2,
    int? thresholdUp,
    int? thresholdUp2,
    String? unit,
  }) {
    return HazardInstrumentHazardTargetVOList()
      ..equipCode = equipCode ?? this.equipCode
      ..equipName = equipName ?? this.equipName
      ..equipTypeDicId = equipTypeDicId ?? this.equipTypeDicId
      ..equipTypeName = equipTypeName ?? this.equipTypeName
      ..hazardCode = hazardCode ?? this.hazardCode
      ..id = id ?? this.id
      ..lastCollectTime = lastCollectTime ?? this.lastCollectTime
      ..lastValue = lastValue ?? this.lastValue
      ..online = online ?? this.online
      ..rangeDown = rangeDown ?? this.rangeDown
      ..rangeUp = rangeUp ?? this.rangeUp
      ..targetCode = targetCode ?? this.targetCode
      ..targetName = targetName ?? this.targetName
      ..targetStatus = targetStatus ?? this.targetStatus
      ..targetTypeDicId = targetTypeDicId ?? this.targetTypeDicId
      ..targetTypeDicName = targetTypeDicName ?? this.targetTypeDicName
      ..thresholdDown = thresholdDown ?? this.thresholdDown
      ..thresholdDown2 = thresholdDown2 ?? this.thresholdDown2
      ..thresholdUp = thresholdUp ?? this.thresholdUp
      ..thresholdUp2 = thresholdUp2 ?? this.thresholdUp2
      ..unit = unit ?? this.unit;
  }
}
